package qimao.com.edu.service.impl;

import java.util.HashMap;
import java.util.Map;

import qimao.com.edu.dao.AdminDao;
import qimao.com.edu.dao.impl.AdminDaoImpl;
import qimao.com.edu.entity.Admin;
import qimao.com.edu.entity.Author;
import qimao.com.edu.service.AdminService;

public class AdminServiceImpl implements AdminService {

	AdminDao adminDao=new AdminDaoImpl(); 
	Admin admin = new Admin();
	@Override
	public Map<String, Object> adminLogin(Admin admin) {
		Map<String,Object> map = new HashMap();
		Admin loginAdmin = adminDao.selectAdmin(admin);
		System.out.println(loginAdmin);
		if(loginAdmin != null) {
			map.put("loginAdmin",loginAdmin);
		}else {
			System.out.println(loginAdmin);
			loginAdmin = adminDao.selectAdminByName(loginAdmin);
			if(loginAdmin == null) {
				map.put("msg","用户名不存在");
			}else {
				map.put("msg","密码错误");
			}
		}
		return map;
	}

	
}
